Startup UNIX user's files

Three files in your home directory (.profile, .bashrc, .bash_logout) have a special meaning to bash, providing a way for you to set up your account environment automatically when you log in and when you invoke another bash shell, and allowing you to perform commands when you log out. These files may already exist in your home directory, depending on how your system administrator has set up your account. If they don't exist, your account is using only the default system file /etc/profile.

.profile

When a UNIX user tries to login to his account, the operating system executes a lot of system files to set up the user account before returning the prompt to the user.

In addition to the system settings, the user might wish to have some specific settings for his own account. To achieve this in UNIX, at the end of the login process, the operating system executes a file at the user level, if present. This file is called profile file. The specific settings which an unix user usually does is:

  • Setting of any environment variable;
  • Setting of any alias.(Though it is always recommended to keep the aliases in a separate file);
  • Setting of PATH variable or any other path variables.

A typical .profile file will look as shown below:

cat $HOME/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export GTK2_RC_FILES=/home/alioth/.gtkrc-2.0

.bashrc

The .bashrc file is a script that is executed whenever a new terminal session is started in interactive mode. The .bashrc file itself contains a series of configurations for the terminal session. This includes setting up or enabling: colouring, completion, the shell history, command aliases and more.

cat $HOME/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
export TERM=xterm-256color
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

.bash_logout

The file .bash_logout is read and executed every time a login shell exits. It is provided to round out the capabilities for customizing your environment. If you wanted to execute some commands that remove temporary files from your account or record how much time you have spent logged in to the system then you would place the commands in .bash_logout. This file doesn't have to exist in your account if it isn't there when you log out, then no extra commands are executed.

.emacs.d directory

After Emacs session was started at first you can see .emacs.d directory in your home directory.

GitHub repository cloning

mkdir DVCS
cd DVCS
git clone https://github.com/annelida/stuff.git

Symbolic link for Emacs configuration file creation

cd .emacs.d/
ln -s /home/vikky/DVCS/stuff/Emacs/init_fijitsu.el -T init.el
cat init.el

Emacs configuration

Org-bullet

M-x package-install [RET] org-bullet [RET]

Voca-builder

M-x package-install [RET] voca-builder [RET]

in init.el file next string was added:

(require 'voca-builder) (setq voca-builder/voca-file "home/vikky/DVCS/stuff/vocabulary.org") (setq voca-builder/export-file "~.voca-builder-temp.org") (setq voca-builder/current-tag "Study")

Key-chord

M-x package-install [RET] key-chord [RET]

in init.el file next string was added:

(require 'key-chord) (key-chord-mode 1) (key-chord-define-global "QQ" 'voca-builder/search-popup) (key-chord-define-global "FF" 'other-frame) (key-chord-define org-mode-map "DD" 'org-drill) (key-chord-define org-mode-map "AA" 'org-drill-again) (key-chord-define org-mode-map "RR" 'org-drill-resume)

Google-translate

M-x package-install [RET] google-translate [RET]

in init.el file next string was added:

(require 'google-translate) (require 'google-translate-default-ui) (global-set-key "\C-ct" 'google-translate-at-point) (global-set-key "\C-cT" 'google-translate-query-translate) (setq google-translate-default-source-language ' "en") (setq google-translate-default-target-language ' "ru")

Magit

M-x package-install [RET] magit [RET]

To display information about the current Git repository, set global key:

(global-set-key (kbd "C-x g") 'magit-status)

Elfeed

M-x package-install [RET] elfeed [RET]

My feed's settings in init.el:

(setq elfeed-feeds '("http://nullprogram.com/feed/" "http://planet.emacsen.org/atom.xml" "http://emacsrocks.com/atom.xml" "http://0--key.github.io/rss.xml" "http://www.quora.com/rss")) ((global-set-key (kbd "C-x w") 'elfeed)



blog comments powered by Disqus

Published

15 November 2017

Categories

Debian DevEnv

Tags